package com;

public class UnsignedUtil {

    public static int getUnsignedShort(short data) {
        return data & 0x0FFFF;
    }

    /**
     * java int (1 int == 4 byte == 32 bit)(-2^31~2^31-1 : -2147483648~2147483647) to unsigned short(0~2^32-1 : 0~4294967295)
     *
     * @param data
     * @return
     */
    public static long getUnsignedInt(int data) {
        return data & 0x0FFFFFFFF;
    }

    public static int getUnsignedByte(byte data) {
        return data & 0x0FF;
    }


}
